<?php
$this->load->helper('text');
$i=1;
foreach ($annonces as $index=>$annonce):
$link=$CFG->config['base_url'].$annonce->link_category.'/'.$annonce->prd_link.'.html';

$tooltipPhoto=(isset($annonce->photo) and count($annonce->photo)>1) ?' <strong class="nbPhoto btn btn-mini close">'.count($annonce->photo).'</strong> ':'';
?>
	
	<article class="row-fluid">
		
		<div class="span12"  itemscope itemtype="http://schema.org/Product" >
			<button class="btn btn-warning btn-mini pull-right btn-check" type="button" onclick="list.add(<?php echo  $annonce->prd_id?>)" title="Sauvegarder dans mes annonces" id="annonce-check-<?php echo  $annonce->prd_id?>">
				<i class="icon-check" ></i>
			</button>
			<h4>
				<a itemprop="url" href="<?php echo $link ?>"  alt="<?php echo str_replace('"',' ',$annonce->prd_name)?>"  > <span itemprop="name"><?php echo  $annonce->prd_name?></span></a>
			</h4>
			<div class="span2" ><a class="thumbnail dropup" href="<?php echo $link ?>">
				<?php echo $tooltipPhoto?>
				<img itemprop="image" alt="<?php echo str_replace('"',' ',$annonce->prd_name)?>"  title="<?php echo str_replace('"',' ',$annonce->prd_name)?>" src="<?php echo  $CFG->config['base_url'].'images/thumbnails/'.$annonce->link_photo?>"  /></a>
			</div>
			<div class="span9"  >
				<div class="span8">
					<?php echo word_limiter(strip_tags(str_replace("<br>",". ",$annonce->prd_description)),50)?>...
				</div>
			 	<div class="span2">
			 		<span class="label label-info"><?php echo  $annonce->prd_codepostal.' - '.$annonce->ville?></span>
			 		
			 		<?php if(!$annonce->is_rencontres){?>
			 		<div  content="<?php echo  str_replace('/' ,' > ', $annonce->link_category)?>"><i><?php echo  $annonce->category_name?></i></div>
			 		<?php }
			 				elseif( !empty($annonce->option))
			 		//pour category rencontre on ne voit que sexe et age
			 				$viewOption=array();
								foreach ($annonce->option as $id=>$option):
									if($annonce->option_label[$id] =='Sexe' and $option) $viewOption[]=$option;
									if($annonce->option_label[$id] =='Age' and $option) $viewOption[]=$option.' Ans';
									
								endforeach;
								if (!empty($viewOption)) echo "<div>".implode('<br/>',$viewOption)."</div>";
								?>
			 		
			 	</div> 
				<div class="span2">
				<br/>
					<time datetime="<?php echo  date('Y-m-d H:i:s',$annonce->date_validate)?>"><?php echo  $annonce->date?></time>	
									<?php if($annonce->prd_price) :?>
					<br/>Prix: <strong  itemprop="offers" itemscope itemtype="http://schema.org/Offer" >
							<span itemprop="price"><?php echo $annonce->prd_price?></span> €
							<meta itemprop="priceCurrency" content="EUR"/>
							<link itemprop="availability" itemtype="http://schema.org/InStock" />
							</strong>
				<?php endif;?>				
					<?php //if($annonce->prd_counter) echo "<div>{$annonce->prd_counter} Vues</div> "?>
				</div>
			</div>
		</div>
	</article>
	<?php echo $i++==count($annonces)?"":"<hr/>"?>
<?php endforeach;?>

<?php if($paging): ?>
<div class="pagination">
	<ul>
	<?php echo $paging?>
	</ul>
</div>
<?php endif;?>

